<template>
  <!-- 营销活动对应信息 -->
  <div class="flex_column">
    <search-section v-enter-search="() => { operate('search') }">
      <!-- 搜索查询 -->
      <div>
        <span>考核月份：</span>
        <el-date-picker
      				class="my-search_datetime" 
              v-model="searchForm.assessMonth"
              type="month"
							value-format="yyyy-MM"
              placeholder="选择考核月份">
        </el-date-picker>
      </div>
      <!-- <div>
        <span>考核状态：</span>
        <el-select v-model="searchForm.assessStatus" clearable filterable class="my-search_datetime" style="width:160px" size="mini" placeholder="请选择考核状态" >
          <el-option v-for="(item,idx) in assessStatusList" :key="idx" :label="item.label" :value="item.value" />
        </el-select>
      </div> -->
      <div slot="button">
        <el-button size="mini" @click="operate('reset')">重置</el-button>
        <el-button size="mini" type="primary" @click="operate('search')">搜索</el-button>
      </div>
    </search-section>
    <!-- 列表信息 -->
    <div class="section main flex_1_auto flex_column shadow_border_normal">
      <el-table
        ref="table"
        size="mini"
        :data="tableList"
        height="100%"
        stripe
        :row-style="{ height: '20px' }"
        :cell-style="{ padding: '0' }"
        border
        header-align="center"
        :header-cell-style="{
          whiteSpace: 'nowrap',
          fontSize: '12px',
          color: '#333',
          fontWeight: '700',
          background: '#f5f5f5',
        }"
      >
        <el-table-column type="index" label="序号" width="60" align="center" show-overflow-tooltip fixed :index="getIndex" />
				<el-table-column prop="assessMonth" label="考核月份"  align="center" show-overflow-tooltip >
					<template slot-scope="{row}">
							<el-link :underline="false" type="primary" @click="$goPage({ path: '/performanceSystem/assessmentManagement/byMonth', query: { month:row.assessMonth}})">{{row.assessMonth}}</el-link>
					</template>
				</el-table-column>
        <el-table-column prop="quantity" label="考核人数" align="center" show-overflow-tooltip  />
      </el-table>
    </div>
    <!-- 分页查询 -->
    <div class="paging">
      <el-pagination :current-page="searchForm.page" :page-sizes="$paginationSize" :page-size="searchForm.size" layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
    </div>
		
  </div>
</template>
<script>
export default {
	name:'allAssessment',
	components: {
	},
	props:{
		
	},
  data() {
    return {
		
		tableList: [], // 指标库列表
      searchForm: {
        current: 1,
        size: this.$defaultPage,
        assessMonth: '', // 考核月份
        assessStatus: [], // 考核状态
      },
      total: 0,
    }
  },
  created() {
		
    // 获取数据
    this.getData()
  },
  methods: {
	
    // 获取列表数据
    async getData() {
      this.reqOnePage()
      // this.reqTwoPage()
    },
    // 获取列表数据(一级分页)
    async reqOnePage() {
      let res = await this.$API.assessAll.reqOnePage(this.searchForm)
      let{ code, responseBody } = res
      if (code == 0) {
        this.tableList = responseBody.records || []
        this.total = Number(responseBody.total)
      }
    },
    // 获取列表数据(一级分页)
    async reqTwoPage() {
      let res = await this.$API.assessAll.reqTwoPage(this.searchForm)
      let{ code, responseBody } = res
      if (code == 0) {
        this.tableList = responseBody.records || []
        this.total = Number(responseBody.total)
      }
    },
   
    // 内部方法
    async operate(type, item) {
      switch (type) {
        case 'reset':
        // 重置
          this.searchForm = this.$options.data.call(this).searchForm
          this.getData()
          break
        case 'search':
          this.searchForm.current = 1
          this.getData()
          break
      }
    },



    // 清空数据信息
    resetForm(formName) {
      this.$refs[formName].resetFields()
      this.searchForm = this.$options.data.call(this).searchForm
    },
    // 分页查询
    handleSizeChange(val) {
      this.searchForm.current = 1
      this.searchForm.size = val
      this.searchOne(this.searchForm)
    },
    handleCurrentChange(val) {
      this.searchForm.current = val
      this.searchOne(this.searchForm)
    },
    getIndex(index) {
      return (
        (this.searchForm.current - 1) * this.searchForm.size + index + 1
      )
    }
  }
}
</script>

<style lang="scss" scoped>
  .main {
    margin-bottom: 10px;
    ::v-deep th {
      height: 20px;
      padding: 1px;
    }
  }

  .dialog-box{
    padding:10px;
	margin-top: 20px;
  }
  .ann_input{
  	width: 300px;
  }

</style>
